package com.baidu.controller;

import com.baidu.pojo.User;
import com.baidu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    UserService ser;

    @RequestMapping
    public String index(){
        return "user/list";
    }

    @RequestMapping("list")
    @ResponseBody
    public List<User> list(User user){
        return ser.selectAll();
    }
}
